package com.zq.structure.bridge;

import java.util.Objects;

public abstract class AbstractImage implements Image {
    protected ImageImp imageImp;
}

class GifImage extends AbstractImage {
    private final ImageImp imageImp;

    public GifImage(ImageImp imageImp) {
        this.imageImp = Objects.requireNonNull(imageImp);
    }

    @Override
    public void draw(String path) {
        imageImp.doPaint("gif:" + path);
    }
}


class PngImage extends AbstractImage {
    private final ImageImp imageImp;

    public PngImage(ImageImp imageImp) {
        this.imageImp = Objects.requireNonNull(imageImp);
    }

    @Override
    public void draw(String path) {
        imageImp.doPaint("png:" + path);
    }
}
